/*
 * bsp_conf.h
 *
 *  Created on: Jun 29, 2025
 *      Author: User
 */

#ifndef INC_BSP_CONF_H_
#define INC_BSP_CONF_H_

#include "main.h"

#define VERSION 10000
#define YEAR 25
#define MONTH 6
#define DAY 20

#define XZC_DY1_MODULE_ENABLED    0
#define XZC_DY2_MODULE_ENABLED    0
#define XZC_GY_MODULE_ENABLED     0
#define XZC_DYZH_MODULE_ENABLED   1

#if  XZC_DY1_MODULE_ENABLED
	#include "bsp_xzc_dy1.h"
#elif  XZC_DY2_MODULE_ENABLED
	#include "bsp_xzc_dy2.h"

#elif  XZC_GY_MODULE_ENABLED
	#include "bsp_xzc_gy.h"

#elif  XZC_DYZH_MODULE_ENABLED
	#include "bsp_xzc_dyzh.h"
#endif
#define JUDEMENTDELAYTIMES 10
typedef struct {
	uint8_t data[8];
}DataBuffer;

typedef struct {
	uint32_t errortimes;
}ErrorBuffer;

extern DataBuffer dataBuffer[DATABUFFERSIZE];
extern ErrorBuffer ErrorID[DATABUFFERSIZE];
extern short temperature;
extern uint32_t temperaturevalue;
extern uint8_t communicationCan1ErrorFlag;
extern ErrorBuffer ErrorCan1ID;
extern float power;

extern uint8_t can1ReciveFlag;
extern uint8_t can2ReciveFlag;
extern uint8_t can1TransmitErrorFlag;
extern uint8_t can2TransmitErrorFlag;
extern uint8_t can1ErrorFlag;
extern uint8_t can2ErrorFlag;

#define temperatureON 0xFC//20211209
#define temperatureOFF 0xFF//20211209
extern uint8_t temperature_flag[8];//20211209
extern uint32_t cumulatetime;//20211209

typedef enum {
	BSP_NORMAL = 0, // 正常状态
	BSP_ALARM = 1, // 告警状态
	BSP_FAULT = 2 // 故障状态
}BOXSTATE;
extern BOXSTATE boxState;
void Upload_To_Xiankong();
void BSP_CheckModulesComError();
void Check_ReceiveFlag(uint32_t extId);
void BSP_UpdateBoxState();

void Configure_Can1_Filter();
void Configure_Can2_Filter();
void BSP_DataInit();

#endif /* INC_BSP_CONF_H_ */
